/*
 * Model.cpp
 *
 *  Created on: 2011/08/07
 *      Author: naoki
 */

#include "StdAfx.h"
#include "NTEngine/NTEngine.h"
#include "NTEngine/Scene/Model.h"
#include "NTEngine/Scene/Batch.h"
#include "NTEngine/Math/Vector3.h"
#include "NTEngine/Math/Matrix3x4.h"
#include "NTEngine/Math/Matrix4x4.h"
#include "NTEngine/Math/Function.h"
#include "NTEngine/Base/ReferenceCounter.h"
#include "NTEngine/Graphics/Manager.h"
#include "NTEngine/Graphics/Enum.h"

#include "Scene/src/ModelImpl.h"

namespace NTEngine{
using namespace Graphics;
using namespace Math;

namespace Scene {

Model::Model( Impl* impl ) : mImpl( impl ){
	if ( mImpl ){
		mImpl->refer();
	}
}

void Model::draw() const {
	mImpl->draw();
}

const Vector3* Model::position() const {
	return &mImpl->mPosition;
}

const Vector3* Model::angle() const {
	return &mImpl->mAngle;
}

const Vector3* Model::scale() const {
	return &mImpl->mScale;
}

const Vector3* Model::color() const {
	return &mImpl->mColor;
}

float Model::transparency() const {
	return mImpl->mTransparency;
}

void Model::setPosition( const Vector3& a ){
	mImpl->mPosition = a;
}

void Model::setAngle( const Vector3& a ){
	mImpl->mAngle = a;
}

void Model::setScale( const Vector3& a ){
	mImpl->mScale = a;
}

void Model::setColor( const Vector3& a ){
	mImpl->mColor = a;
}

void Model::setTransparency( float a ){
	mImpl->mTransparency = a;
}

#define TYPE Model
#include "NTEngine/Base/Impl/ReferenceCounterTemplate.h"
#define TYPE Model
#define CONST_TYPE ConstModel
#include "NTEngine/Base/Impl/ConstantTypeTemplate.h"

void ConstModel::draw() const {
	mBase.draw();
}

const Vector3* ConstModel::position() const {
	return mBase.position();
}

const Vector3* ConstModel::angle() const {
	return mBase.angle();
}

const Vector3* ConstModel::scale() const {
	return mBase.scale();
}

const Vector3* ConstModel::color() const {
	return mBase.color();
}

float ConstModel::transparency() const {
	return mBase.transparency();
}

} //namespace Scene
} //namespace GameLib
